package com.xy.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/*
 * 学生领书表
 */
@SuppressWarnings("serial")
@Entity
@Table
@Cacheable
public class DeliverToStudent extends Identified implements Serializable {

  private Date deliverTime;// 发书时间
  // 对应到套书表
  @ManyToOne(targetEntity = PackageBook.class)
  @JoinColumn(name = "PackageBook_Id", referencedColumnName = "id" )
  @Cascade(CascadeType.SAVE_UPDATE)
  private PackageBook packageBook;
  // 对应到套书
  @OneToOne(targetEntity = Student.class)
  @JoinColumn(name = "Student_id", referencedColumnName = "id")
  private Student student;
  // 对应到管理员
  @ManyToOne(targetEntity = Admin.class)
  @JoinColumn(name = "Admin_Id", referencedColumnName = "id" )
  @Cascade(CascadeType.SAVE_UPDATE)
  private Admin admin;

  public Date getDeliverTime() {
    return deliverTime;
  }

  public void setDeliverTime(Date deliverTime) {
    this.deliverTime = deliverTime;
  }

  public PackageBook getPackageBook() {
    return packageBook;
  }

  public void setPackageBook(PackageBook packageBook) {
    this.packageBook = packageBook;
  }

  public Student getStudent() {
    return student;
  }

  public void setStudent(Student student) {
    this.student = student;
  }

  public Admin getAdmin() {
    return admin;
  }

  public void setAdmin(Admin admin) {
    this.admin = admin;
  }

  public DeliverToStudent() {
    super();
    // TODO Auto-generated constructor stub
  }

}
